<?php
/**
 * 
 * @author Paolo Bertuzzo
 *
 */
namespace Catalog\Helper;

use Zend\View\Helper\Partial;
use Utilities\Session\SessionFacade;

class ProductImagesCarouselHelper extends Partial
{

    /**
     * (non-PHPdoc)
     *
     * @see \Zend\View\Helper\Partial::__invoke()
     */
    public function __invoke($name = NULL, $values = NULL)
    {
        $mainImage = null;
        $carouselImages = array();
        
        foreach ($values['images'] as $image)
        {
        	if ($image->getType() == 'detail_main')
        	    $mainImage = $image->getUrl();
        	else if ($image->getType() == 'detail_carousel')
                array_push($carouselImages, $image->getUrl());        	    
        }
        
        return parent::__invoke('helper/product_images_carousel', array(
        	'main_image' => $mainImage,
            'carousel_images' => $carouselImages
        ));
    }
        
}

?>